﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace CloudMusic.DicEventHelper
{
    /// <summary>
    /// 资源字典里的事件集合
    /// </summary>
    public partial class DicEvent : ResourceDictionary
    {
        /// <summary>
        /// 跳转页面事件-每日歌曲
        /// </summary>
        public static event EventHandler GoToView;
        /// <summary>
        /// 跳转页面事件-精品歌单
        /// </summary>
        public static event EventHandler GoToJPView;
        /// <summary>
        /// 播放歌单页面
        /// </summary>
        public static event EventHandler GoToPlay;
        /// <summary>
        /// 歌手页
        /// </summary>
        public static event EventHandler GoToSingerPage;
        /// <summary>
        /// 歌手主页
        /// </summary>
        public static event EventHandler GoToHomePage;
        
        /// <summary>
        /// 推荐歌单点击后的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void view_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Viewbox vb = sender as Viewbox;
            GoToView?.Invoke(vb.Tag, null);
        }
        /// <summary>
        /// 精品歌单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void jpView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Viewbox vb = sender as Viewbox;
            GoToJPView?.Invoke(vb.Tag, null);
        }
        /// <summary>
        /// 点击歌单下方文字导航到歌单页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void goView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock tb = sender as TextBlock;
            GoToView?.Invoke(tb.Tag, null);
        }
        /// <summary>
        /// 点击播放按钮播放歌单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlay_Click(object sender, RoutedEventArgs e)
        {
            Button bt = sender as Button;
            GoToPlay?.Invoke(bt.Tag, null);
        }
        /// <summary>
        /// 播放按钮鼠标上移后的动画
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlay_MouseLeave(object sender, MouseEventArgs e)
        {
            Button bt = sender as Button;
            bt.Visibility = Visibility.Collapsed;
        }
        /// <summary>
        /// 播放按钮鼠标移除后的动画
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlay_MouseEnter(object sender, MouseEventArgs e)
        {
            Button bt = sender as Button;
            bt.Visibility = Visibility.Visible;
        }
        
        /// <summary>
        /// 歌手个人主页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void goHomePage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Border bd = sender as Border;
            GoToHomePage?.Invoke(bd.Tag, null);
        }
        /// <summary>
        /// 歌手页-文字
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void goSingerPage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock tb = sender as TextBlock;
            GoToSingerPage?.Invoke(tb.Tag, null);
        }
        /// <summary>
        /// 歌手页-viewBox/图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void goSingerPage_view_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Image vb = sender as Image;
            GoToSingerPage?.Invoke(vb.Tag, null);
        }
        /// <summary>
        /// 歌手账号鼠标上移后背景图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void singerImg_MouseEnter(object sender, MouseEventArgs e)
        {
            Border bd = sender as Border;
            bd.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E8E8E8"));
        }
        /// <summary>
        /// 歌手账号鼠标离开后背景图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void singerImg_MouseLeave(object sender, MouseEventArgs e)
        {
            Border bd = sender as Border;
            bd.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
        }
    }
}
